<?php
require_once("../../resources/commons.php");
require_once("../../data/User.php");
require_once("../../data/Report.php");
require_once("../../data/Item.php");
require_once("dashboard_commons.php");

SessionManager::getInstance()->checkSession();
displaySimpleTop("Global report per activity");

$l_myUserId=SessionManager::getCurrentLoggedUserId();
$l_user=User::getFromPrimaryKey($l_myUserId);
$l_results=$l_user->getFullTeam();

$l_teamActivities=array();
if(count($l_results)!=0){
	foreach($l_results as $l_teamMember){
		$l_teamActivities=array_merge($l_teamActivities,$l_teamMember->getOpenActivities());
	}
}
$l_teamActivities=array_merge($l_teamActivities,$l_user->getOpenActivities());

if(count($l_teamActivities)!=0){
	foreach($l_teamActivities as $l_teamActivity){
		echo "<div style=\"page-break-after: always;\">";
		echo "<div style=\"border:1px solid;font-size: xx-large;background-color: black;color: white;\">" . $l_teamActivity->getTitle() . "</div><br/>";
		displayActivityDashboard($l_teamActivity,false);
		echo "</div>";
	}
}else{
	?>
	<div style="color: white;background-color: red;">No activities</div>
	<?php
}

displaySimpleBottom();
?>